package leetcode

func hIndex(citations []int) int {
    h := 0
    for i := len(citations) - 1; i >= 0 && citations[i] > h; i -- {
        h ++
    } 
    return h
}